//author:jxx
//此处是对表单的方法，组件，权限操作按钮等进行任意扩展(方法扩展可参照SellOrder.js)
let extension = {
  components: {//动态扩充组件或组件路径
    //表单header、content、footer对应位置扩充的组件
    gridHeader: () =>
      import("./account/mall_accountingHeader.vue"),//账务处理弹出框
    gridBody: () =>
      import("./account/accountsAdd.vue"),//新建弹出框
    gridFooter: '',
    //弹出框(修改、编辑、查看)header、content、footer对应位置扩充的组件
    modelHeader: '',
    modelBody: '',
    modelFooter: '',


  },
  buttons: { view: [], box: [], detail: [] },//扩展的按钮
  methods: {//事件扩展
    onInit () {
      this.maxBtnLength = 4;
      this.boxOptions.height = 530;
      // 表格添加操作列
      this.columns.push({
        title: '操作',
        fixed: 'right',
        width: 140,
        render: (h, { row, column, index }) => {
          return h(
            "div", { style: {} }, [
            h(
              "a", {
              props: {},
              style: {},
              on: {
                click: (e) => {
                  //this.$Message.info(row.accountsReceivable);
                  // e.stopPropagation()
                  //console.log(this.$refs.gridHeader)
                  this.$refs.gridHeader.open(row);
                }
              }
            },
              "财务处理  "
            ),
            h(
              "a", {
              props: {},
              style: {},
              on: {
                click: (e) => {
                  this.linkData(row);
                }
              }
            },
              "编辑"
            ),

          ])
        }
      })
      // 表格 是否 转换
      this.columns.forEach(item => {
        let field = item.field
        if (field == "is_entryaccount" || field == "is_credit" || field == "is_valid" || field == "is_autostop") {
          let abc = {
            key: "audit",
            data: [
              { key: 0, value: "否" },
              { key: 1, value: "是" },
            ],
          }
          this.$set(item, 'bind', abc)
        }
      })
      // 操作新建按钮
      this.buttons.forEach(item => {
        if (item.value == "Add") {
          item.onClick = () => {
            this.$refs.gridBody.open();
          }
        }
      })
    },
    refresh () {
      // this.$refs.
    },
    rowClick ({ row, column, event }) { //查询界面table点击行选中当前行
      console.log(row, column, event);

      this.$refs.table.$refs.table.toggleRowSelection(row);

      return true;
    },
    loadAfter (data, callBack) {
      console.log("wxj", data);
      return true
    }
  }
};
export default extension;